-- Copyright 2013 ECHO Games
-- This file is a part of Galaga Revolution
-- Galaga Revolution is free software licensed under the GNU General Public License version 3.
-- You may redistribute and/or modify it under the terms of the GNU General Public License
-- version 3 as published by the Free Software Foundation.updater
-- Galaga Revolution comes without a warranty; without even the implied warranty of merchantability
-- or fitness for a particular purpose. See the GNU General Public License version 3 for more
-- details.
-- You should have received the GNU General Public License version 3 with this in GPL.txt
-- if not it is available at <http://www.gnu.org/licenses/gpl.txt>.
-- All resources for Galaga Revolution including: source code, compiled jar, documentation, and source
-- notes are available at: <http://code.google.com/p/echo-gaming-galaga-revolution/>

player = {}
player.x = 280
player.y = 550
player.xvel = 0
player.yvel = 0
player.speed = 3
player.friction = 3.5
player.health = 1
player.damage = 1
player.width = 40
player.height = 40
player.shots = {}

player.pic = love.graphics.newImage("ship.jpg")

function player_draw()
        love.graphics.setColor(255,255,255)
        love.graphics.draw(player.pic,player.x,player.y)
end
function player_control(dt)
        player.x = player.x + player.xvel       
        player.xvel = player.xvel * (1 - math.min(dt*player.friction, 1))
        
        if love.keyboard.isDown("right") and
                player.xvel < 100 then
                player.xvel = player.xvel + player.speed * dt
        end
        if love.keyboard.isDown("left") and
                player.xvel > -100 then
                player.xvel = player.xvel - player.speed * dt
        end
end